package com.kang.c0c.tree.node;


/**
 * 定义了抽象语法树中的if子节点
 * if			：IF		条件选择 if'('condition')'Block1 else Block2';'
 * 
 * @field:
 * condition	：条件子节点
 * execBlock	：condition为真时执行的程序块节点
 * elseBlock	：condition为假时执行的程序快节点
 * 
 * @author kang
 *
 * Feb 6, 2009
 */

public class IfNode extends Node implements Nodes{
	private BinaryNode condition;
	private BlockNode execBlock;
	private BlockNode elseBlock;
	
	public IfNode(){
		this(null,null,null);
	}
	
	public IfNode(BinaryNode condition,BlockNode execBlock){
		this(condition,execBlock,null);
	}
	
	public IfNode(BinaryNode condition,BlockNode execBlock,BlockNode elseBlock){
		super(IF);
		this.condition = condition;
		this.elseBlock = elseBlock;
		this.execBlock = execBlock;
	}

	public BinaryNode getCondition() {
		return condition;
	}

	public void setCondition(BinaryNode condition) {
		this.condition = condition;
	}

	public BlockNode getExecBlock() {
		return execBlock;
	}

	public void setExecBlock(BlockNode execBlock) {
		this.execBlock = execBlock;
	}

	public BlockNode getElseBlock() {
		return elseBlock;
	}

	public void setElseBlock(BlockNode elseBlock) {
		this.elseBlock = elseBlock;
	}

	
}
